package cn.mymall.entity;

import cn.mymall.entity.mall.Product;
import cn.mymall.entity.mall.Sku;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;

/**
 * <p>
 *
 * </p>
 *
 * @author liqilun
 * @since 2024-03-23
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class OrderItem extends Model {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    private Integer orderId;

    private Integer productId;

    private String productName;

    private String logo;

    private Integer skuId;

    private String skuName;

    private Integer qty;

    private BigDecimal sellPrice;

    private BigDecimal costPrice;

    private BigDecimal discount;

    private String orderStatus;

    private String expressNo;

    private String expressType;

    private String expressStatus;

    public OrderItem(){

    }
    public OrderItem(Product product, Sku sku, Integer qty, TradeOrder order){
        this.orderId = order.getId();
        this.productId = product.getId();
        this.qty = qty;
        this.productName = product.getName();
        this.logo = product.getLogo();
        this.skuId = sku.getId();
        this.skuName = sku.getName();
        this.sellPrice = sku.getSellPrice();
        this.costPrice = sku.getCostPrice();
        this.discount = BigDecimal.ZERO;
    }

}
